<template>
  <el-form ref="form" :inline="false" :model="form" label-width="120px">
    <el-row class="group-name">人员信息</el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="姓名" prop="studentName">
          <span>{{ form.studentName }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="证件照片" prop="papersImage">
          <el-image
            :src="form.papersImage"
            style="width: 140px; height: 140px"
          ></el-image>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="性别" prop="studentSex">
          <dict-tag
            :type="DICT_TYPE.SYSTEM_USER_SEX"
            :value="form.studentSex"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="年龄" prop="studentAge">
          <span>{{ form.studentAge }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="出生日期" prop="birthday">
          <span>{{ parseTime(form.birthday, "{y}-{m}-{d}") }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="民族" prop="nation">
          <span>{{ form.nation }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="籍贯" prop="natively">
          <span>{{ form.natively }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="修行类型" prop="monastical">
          <dict-tag
            :type="DICT_TYPE.STUDENT_MONASTICAL_TYPE"
            :value="form.monastical"
          />
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="婚姻状况" prop="maritalStatus">
          <dict-tag
            :type="DICT_TYPE.USER_MARITAL_STATUS"
            :value="form.maritalStatus"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="文化程度" prop="education">
          <dict-tag :type="'system_education'" :value="form.education" />
        </el-form-item>
      </el-col>
    </el-row>

    <el-row class="group-name">证件信息</el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="证件类型" prop="papersType">
          <dict-tag :type="'user_papers_type'" :value="form.education" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="证件号码" prop="identityCardNumber">
          <span>{{ form.identityCardNumber }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="证件正面照" prop="frontImage">
          <el-image
            :src="form.frontImage"
            style="width: 140px; height: 140px"
          ></el-image>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="证件反面照" prop="reversesImage">
          <el-image
            :src="form.reversesImage"
            style="width: 140px; height: 140px"
          ></el-image>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="证件地址" prop="papersAddress">
          <span>{{ form.papersAddress }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="居住地址" prop="dwellAddress">
          <span>{{ form.dwellAddress }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="本人电话" prop="phone">
          <span>{{ form.phone }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="邮箱" prop="email">
          <span>{{ form.email }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="微信" prop="wechat">
          <span>{{ form.wechat }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row class="group-name">紧急联系人信息</el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="紧急联系人关系" prop="instancyRelation">
          <el-input
            v-model="form.instancyRelation"
            placeholder="请输入紧急联系人关系"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="紧急联系人" prop="instancyContacts">
          <el-input
            v-model="form.instancyContacts"
            placeholder="请输入紧急联系人"
          />
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="紧急联系人电话" prop="instancyContactsPhone">
          <el-input
            v-model="form.instancyContactsPhone"
            placeholder="请输入紧急联系人电话"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="备用电话" prop="standbyPhone">
          <el-input v-model="form.standbyPhone" placeholder="请输入备用电话" />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row class="group-name">毕业信息</el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="毕业时间" prop="graduateTime">
          <span>{{ parseTime(form.graduateTime, "{y}-{m}-{d}") }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="毕业编号" prop="graduateNumber">
          <span>{{ form.graduateNumber }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="毕业结论" prop="graduateVerdict">
          <span>{{ form.graduateVerdict }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="学位编号" prop="degreeNumber">
          <span>{{ form.degreeNumber }}</span>
        </el-form-item>
      </el-col>
    </el-row>
    <el-form-item>
      <el-button type="primary" size="mini" @click="submit">保存</el-button>
      <el-button type="danger" size="mini" @click="close">关闭</el-button>
    </el-form-item>
  </el-form>
</template>
  
  <script>
import { updateStudentProfile } from "@/api/system/user";
import ImageUpload from "@/components/ImageUpload";
export default {
  props: {
    form: {
      type: Object
    }
  },
  components: { ImageUpload },
  data() {
    return {
    };
  },
  methods: {
    submit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          updateStudentProfile(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
          });
        }
      });
    },
    close() {
      this.$tab.closePage();
    }
  }
};
  </script>

<style lang="scss" scoped>
.group-name {
  padding: 10px;
  border-bottom: 1px solid #f5f5f5;
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: bold;
}

::v-deep .el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: auto;
}
</style>
  